import React from 'react';
import BillItem from './BillItem';

export default function BillTable({data,title}) {
	let date = data.month.split('-');

	return (
		<div>
			<div className="bill_title">
			{title}
			</div>
			<div className="bill_value">
				{data.items[0] ? data.items[0].over : '0.00'}
			</div>

			<div className="bill_bg">
				<div className="bill_content">
					<div className="bill_time">
						帐单时间：{date[0]}年{date[1]}月
					</div>
					<div className="bill_list">
						{
							data.items.map((item, index) => {
								return (
									<BillItem key={index} item={item} />
								);
							})
						}
					</div>
				</div>
			</div>
		</div>
	);
}